package com.hongyi.demo.controller;

import com.hongyi.common.framework.domain.JsonResult;
import com.hongyi.common.web.controller.BaseController;
import com.hongyi.demo.service.ItomasService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@RestController
@RequestMapping("/tomas")
public class TomasController extends BaseController {

    @Autowired
    private ItomasService tomasService;

    @PostMapping(value = "/readData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    public JsonResult<Void> readData(MultipartFile file, HttpServletResponse response) throws IOException {
        return toResult(tomasService.readData(file,response ));
    }

}
